import 'package:flutter/material.dart';

///
///底部tab，单个，需放置在[Row], [Column], or [Flex]中.
///
class TabIcon extends StatelessWidget {
  final String asset, name;
  final GestureTapCallback onTap;

  TabIcon(this.asset, this.name, {Key key, this.onTap}) : super(key: key);

  @override
  Widget build(BuildContext context) => Expanded(
        child:
        GestureDetector(
          child: Container(
            padding: EdgeInsets.all(7.0),
            color: Colors.white,
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                Image.asset(
                  asset,
                  fit: BoxFit.cover,
                  width: 22.0,
                  height: 22.0,
                ),
                Container(
                  child: Text(
                    '$name',
                    style: TextStyle(fontSize: 13.0),
                  ),
                  margin: EdgeInsets.only(top: 1.5),
                ),
              ],
            ),
          ),
          onTap: onTap,
        ),
      );
}
